package com.ff.neuropp.controller;


import com.ff.neuropp.service.AppCareerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * app端 职业生涯信息
 */
@RestController
@RequestMapping("/app/career")
@Api(value = "app职业生涯controller", tags = {"app职业生涯接口"})
public class AppCareerController {


    @Autowired
    private AppCareerService appCareerService;

    @GetMapping("/typeList")
    @ApiOperation(value = "职业生涯分类列表", notes = "职业生涯分类列表")
    public Map<String, Object> careerType(@ApiParam(required = false, value = "职业生涯名称模糊搜索")@RequestParam(required = false) String careerName){
        return appCareerService.careerType(careerName);
    }


    @GetMapping("/list")
    @ApiOperation(value = "职业生涯列表", notes = "职业生涯列表")
    public Map<String,Object> careeList(@ApiParam(required = true, value = "职业生涯类型ID")@RequestParam(required = true) Integer typeId){
        return appCareerService.careerList(typeId);
    }
    
    @GetMapping("/careeDetail")
    @ApiOperation(value = "职业生涯详情", notes = "职业生涯详情")
    public Map<String,Object>  careeDetail(@ApiParam(required = true, value = "职业生涯ID")@RequestParam(required = true) Integer careerId){
        return appCareerService.careeDetail(careerId);
    }

    @GetMapping("/courses")
    @ApiOperation(value = "职业生涯对应课程信息", notes = "职业生涯对应课程信息")
    public Map<String,Object> courses(@ApiParam(required = true, value = "职业生涯ID")@RequestParam(required = true) Integer careerId){
        return appCareerService.careerCourses(careerId);
    }

    @GetMapping("/resource")
    @ApiOperation(value = "职业生涯对应资源信息", notes = "职业生涯对应资源信息")
    public Map<String,Object> resource(@ApiParam(required = true, value = "职业生涯ID")@RequestParam(required = true) Integer careerId){
        return appCareerService.resourceList(careerId);
    }
    
    @GetMapping("/resourceDetail")
    @ApiOperation(value = "资源详情", notes = "资源详情")
    public Map<String,Object> resourceDetail(@ApiParam(required = false, value = "资源详情id") @RequestParam(required = true) Integer  resourceId,@ApiParam(required = true, value = "职业生涯ID")@RequestParam(required = true) Integer careerId){
        return appCareerService.resourceDetail(resourceId,careerId);
    }
    
    @GetMapping("/resourceClickDetail")
    @ApiOperation(value = "资源详情上半部分", notes = "资源详情上半部分刷新")
    public Map<String,Object> resourceClickDetail(@ApiParam(required = false, value = "资源详情id") @RequestParam(required = true) Integer  resourceId,@ApiParam(required = true, value = "资源时间")@RequestParam(required = true) String resourceDate){
        return appCareerService.resourceClickDetail(resourceId,resourceDate);
    }
}
